/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package schema;

/**
 *
 * @author Antonio
 */
public class Simbolo {

    private Disuguaglianze disuguaglianza;
    private Coordinate coordinataA;
    private Coordinate coordinataB;

    public Simbolo(Disuguaglianze disuguaglianza, Coordinate coordinataA, Coordinate coordinataB) {

        this.disuguaglianza = disuguaglianza;
        this.coordinataA = coordinataA;
        this.coordinataB = coordinataB;

    }

    public Disuguaglianze getDisuguaglianza() {
        return disuguaglianza;
    }

    public Coordinate getCoordinataA() {
        return coordinataA;
    }

    public Coordinate getCoordinataB() {
        return coordinataB;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 53 * hash + (this.coordinataA != null ? this.coordinataA.hashCode() : 0);
        hash = 53 * hash + (this.coordinataB != null ? this.coordinataB.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Simbolo other = (Simbolo) obj;
        if (this.coordinataA != other.coordinataA && (this.coordinataA == null || !this.coordinataA.equals(other.coordinataA))) {
            return false;
        }
        if (this.coordinataB != other.coordinataB && (this.coordinataB == null || !this.coordinataB.equals(other.coordinataB))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {

        StringBuilder sb = new StringBuilder("{");

        sb.append(coordinataA);

        if (disuguaglianza == Disuguaglianze.GT) {

            sb.append(" > ");
        } else {

            sb.append(" < ");
        }

        sb.append(coordinataB).append("}\n");

        return sb.toString();
    }
}
